package com.changli02.tryCatchFinally;

import java.util.InputMismatchException;
import java.util.Scanner;

public class trycatchfinally {
    public static void main(String[] args) {
//        //        5.InputMismatchException 异常
//        try {
//            Scanner sc = new Scanner(System.in);
//            int a = sc.nextInt();
//            System.out.println(a);
//        }catch(InputMismatchException e){
//            System.out.println("InputMismatchException 异常");
//        }
        //        4.NumberFormatException异常
        try {
            String name = "123a";
            int i = Integer.parseInt(name);
            System.out.println(i);
        }
        catch (NumberFormatException e) {
            e.printStackTrace();
        }
        System.out.println("运行结束");
    }
}
